package com.ezmobo.dao.Student;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface StudentMapper {
	
	 @Select("select * from student")
	 @ResultMap("com.ezmobo.dao.Student.StudentDOMap")
	 public List<StudentDO> getStudents();
	
	 @Insert("insert into student (name, age,sex, cdate) values (#{student.name},#{student.age},#{student.sex},#{student.cdate})")
	 @Options(useGeneratedKeys = true, keyProperty = "student.id")
	 public int addStudent(@Param("student") StudentDO student);
	
	 @Delete("delete from student where name = #{name}")
	 public int deleteStudent(@Param("name") String name);
	
	 @Update("update student set name = #{student.name}, age = #{student.age},sex = #{student.sex} where id = #{student.id}")
	 public int updateStudent(@Param("student") StudentDO student);

//	public List<StudentDO> getStudents();
//
//	public int addStudent(@Param("student") StudentDO student);
//
//	public int deleteStudent(@Param("name") String name);
//
//	public int updateStudent(@Param("student") StudentDO student);
}
